package com.example.nettyrpcdemo.core;

import java.lang.reflect.Method;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Data
public class RpcCmdExecutor {

    private Method method;

    private Object handler;

    public RpcCmdExecutor(Method method, Object handler) {
        this.method = method;
        this.handler = handler;
    }

    /**
     * 反射调用
     *
     * @param param
     * @throws Exception
     */
    public void invoke(GameRpcMsgContext param) throws Exception {
        method.invoke(handler, param);
    }
}
